home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3dm / audio / alReadFrames.z / alReadFrames
Encoding:
Text File  |  2002-10-03  |  5.4 KB  |  133 lines

  1.  
  2.  
  3.  
  4. aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss((((3333ddddmmmm))))                                            aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss((((3333ddddmmmm))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      alReadFrames - read interleaved sample frames from an audio port
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiioooo....hhhh>>>>
  13.  
  14.      iiiinnnntttt aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss((((ccccoooonnnnsssstttt AAAALLLLppppoooorrrrtttt ppppoooorrrrtttt,,,, vvvvooooiiiidddd ****ssssaaaammmmpppplllleeeessss,,,, ccccoooonnnnsssstttt iiiinnnntttt ffffrrrraaaammmmeeeeccccoooouuuunnnntttt))))
  15.  
  16. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRR
  17.      _p_o_r_t         is the audio input port from which you want to read samples.
  18.                   This is the returned value of an aaaallllOOOOppppeeeennnnPPPPoooorrrrtttt((((3333ddddmmmm)))) call.
  19.  
  20.      _s_a_m_p_l_e_s      is the buffer into which you want to read the samples.
  21.  
  22.      _f_r_a_m_e_c_o_u_n_t   is the number of sample frames that you want to read from
  23.                   the audio port.
  24.  
  25. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  26.      aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss transfers data from an audio port to the _s_a_m_p_l_e_s buffer.
  27.      aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss blocks until _f_r_a_m_e_c_o_u_n_t sample frames have been transferred
  28.      to the _s_a_m_p_l_e_s buffer.  If you do not wish to block, make sure that
  29.      _f_r_a_m_e_c_o_u_n_t is less than the return value of aaaallllGGGGeeeettttFFFFiiiilllllllleeeedddd((((3333ddddmmmm)))).
  30.  
  31.      The format of the data written into _s_a_m_p_l_e_s depends upon the
  32.      configuration of the port. Each sample can be an 8-, 16-, or 32-bit
  33.      integer, or a single- or double-precision floating-point value or subcode
  34.      data; see aaaallllSSSSeeeettttSSSSaaaammmmppppFFFFmmmmtttt((((3333ddddmmmm)))), aaaallllSSSSeeeettttFFFFllllooooaaaattttMMMMaaaaxxxx((((3333ddddmmmm)))) and aaaallllSSSSeeeettttWWWWiiiiddddtttthhhh((((3333ddddmmmm)))) for a
  35.      description of how these formats work. By default, the sample format is
  36.      16-bit integer (short).
  37.  
  38.      Within each sample frame, aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss provides interleaved data. The
  39.      number of samples per sample frame varies according to the value
  40.      specified by aaaallllSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllssss((((3333ddddmmmm)))). By default, the port provides stereo
  41.      data (2 samples per frame).
  42.  
  43.      In order to achieve the best possible performance, aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss does not
  44.      verify that _p_o_r_t or _s_a_m_p_l_e_s are valid. You should make certain these
  45.      values are valid before passing them as arguments to aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss.
  46.  
  47. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  48.      The following code fragment opens an audio input port and reads audio
  49.      data from it.
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss((((3333ddddmmmm))))                                            aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss((((3333ddddmmmm))))
  71.  
  72.  
  73.  
  74.           ALport p;
  75.           short buf[10000];   /* 5000 stereo frames */
  76.  
  77.           /* open a port with the default configuration */
  78.           p = alOpenPort("alReadFrames example","r",0);
  79.  
  80.           if (!p) {
  81.               printf("port open failed:%s\n", alGetErrorString(oserror()));
  82.           }
  83.  
  84.           while (1) {
  85.               alReadFrames(p, buf, 5000);         /* read 5000 stereo frames */
  86.  
  87.               /* do something here with the audio data */
  88.           }
  89.  
  90.  
  91. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  92.      aaaallllRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss always returns 0.
  93.  
  94. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  95.      alOpenPort(3dm), alGetFillable(3dm), alGetFilled(3dm),
  96.      alSetChannels(3dm), alSetWidth(3dm), alWriteFrames(3dm),
  97.      alDiscardFrames(3dm), alSetConfig(3dm), alSetQueueSize(3dm),
  98.      alSetSampFmt(3dm), alSetFloatMax(3dm)
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.